package com.hn658.groupshare.config.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;
import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
import com.baidu.disconf.client.common.update.IDisconfUpdate;
import com.hn658.groupshare.config.service.IGroupShareConfig;

/**
 * 
 * 统一用户系统配置文件
 * @author ztjie
 * @date 2015-10-22 下午1:39:24
 * @since
 * @version
 */
@Service
@Scope("singleton")
@DisconfFile(filename = "groupshare.properties")
@DisconfUpdateService(classes = {DisconfGroupShareConfig.class})
public class DisconfGroupShareConfig implements IDisconfUpdate, IGroupShareConfig {

    protected static final Logger LOGGER = LoggerFactory.getLogger(DisconfGroupShareConfig.class);

	//#####################5173短信发送配置信息
	//接入服务的客户端IP
    private String client5173IP;

	//接入服务的客户端key
    private String client5173key;

    //接入服务的短信类型
    private String client5173Category;
    
    //web服务请求url
    private String client5173RequestUrl;

    /**
     * 5173短信平台接入客户端服务器IP, 分布式文件配置
     *
     * @return
     */
    @Override
    @DisconfFileItem(name = "5173.client.ip", associateField = "client5173IP")
    public String getClient5173IP() {
    	return client5173IP;
    }
    
    public void setClient5173IP(String client5173ip) {
    	client5173IP = client5173ip;
    }
    

	/**
     * 5173短信平台接入客户端服务器key, 分布式文件配置
     *
     * @return
     */
    @Override
    @DisconfFileItem(name = "5173.client.key", associateField = "client5173key")
	public String getClient5173key() {
		return client5173key;
	}

	public void setClient5173key(String client5173key) {
		this.client5173key = client5173key;
	}

	/**
     * 5173短信平台接入服务的短信类型, 分布式文件配置
     *
     * @return
     */
	@Override
    @DisconfFileItem(name = "5173.client.category", associateField = "category")
    public String getClient5173Category() {
		return client5173Category;
	}

	public void setClient5173Category(String client5173Category) {
		this.client5173Category = client5173Category;
	}
	
	/**
     * 5173短信平台接入服务请求URL, 分布式文件配置
     *
     * @return
     */
	@Override
    @DisconfFileItem(name = "5173.client.requestUrl", associateField = "requestUrl")
    public String getClient5173RequestUrl() {
		return client5173RequestUrl;
	}

	public void setClient5173RequestUrl(String client5173RequestUrl) {
		this.client5173RequestUrl = client5173RequestUrl;
	}

	@Override
    public void reload() throws Exception {
        
    }

	private int httpClientTimeout;
	
	private int httpClientSotimeout;
	
	private int httpClientMaxConnection;
	
	private int httpClientMaxRouteConnection;
	
	private int httpClientSocketBuffersize;
	
	private int httpClientMaxRetry;
	
	@DisconfFileItem(name = "httpclient.connection.timeout", associateField = "httpClientTimeout")
	public int getHttpClientTimeout() {
		return httpClientTimeout;
	}

	public void setHttpClientTimeout(int httpClientTimeout) {
		this.httpClientTimeout = httpClientTimeout;
	}

	@DisconfFileItem(name = "httpclient.connection.sotimeout", associateField = "httpClientSotimeout")
	public int getHttpClientSotimeout() {
		return httpClientSotimeout;
	}

	public void setHttpClientSotimeout(int httpClientSotimeout) {
		this.httpClientSotimeout = httpClientSotimeout;
	}

	@DisconfFileItem(name = "httpclient.connection.maxconnection", associateField = "httpClientMaxConnection")
	public int getHttpClientMaxConnection() {
		return httpClientMaxConnection;
	}

	public void setHttpClientMaxConnection(int httpClientMaxConnection) {
		this.httpClientMaxConnection = httpClientMaxConnection;
	}

	@DisconfFileItem(name = "httpclient.connection.maxrouteconnection", associateField = "httpClientMaxRouteConnection")
	public int getHttpClientMaxRouteConnection() {
		return httpClientMaxRouteConnection;
	}

	public void setHttpClientMaxRouteConnection(int httpClientMaxRouteConnection) {
		this.httpClientMaxRouteConnection = httpClientMaxRouteConnection;
	}

	@DisconfFileItem(name = "httpclient.connection.socketbuffersize", associateField = "httpClientSocketBuffersize")
	public int getHttpClientSocketBuffersize() {
		return httpClientSocketBuffersize;
	}

	public void setHttpClientSocketBuffersize(int httpClientSocketBuffersize) {
		this.httpClientSocketBuffersize = httpClientSocketBuffersize;
	}

	@DisconfFileItem(name = "httpclient.connection.maxretry", associateField = "httpClientMaxRetry")
	public int getHttpClientMaxRetry() {
		return httpClientMaxRetry;
	}

	public void setHttpClientMaxRetry(int httpClientMaxRetry) {
		this.httpClientMaxRetry = httpClientMaxRetry;
	}

	private String isOpenIp;
	private String sinaValidateIpUrl;
	private String passAddress;
	private String passIp;
	
	@DisconfFileItem(name = "validate.ip.isopen", associateField = "isOpenIp")
	public String getIsOpenIp() {
		return isOpenIp;
	}

	public void setIsOpenIp(String isOpenIp) {
		this.isOpenIp = isOpenIp;
	}

	@DisconfFileItem(name = "sina.validate.ip.url", associateField = "sinaValidateIpUrl")
	public String getSinaValidateIpUrl() {
		return sinaValidateIpUrl;
	}

	public void setSinaValidateIpUrl(String sinaValidateIpUrl) {
		this.sinaValidateIpUrl = sinaValidateIpUrl;
	}

	@DisconfFileItem(name = "validate.pass.address", associateField = "passAddress")
	public String getPassAddress() {
		return passAddress;
	}

	public void setPassAddress(String passAddress) {
		this.passAddress = passAddress;
	}

	@DisconfFileItem(name = "validate.pass.ip", associateField = "passIp")
	public String getPassIp() {
		return passIp;
	}

	public void setPassIp(String passIp) {
		this.passIp = passIp;
	}
	
	private String imageRootDir;
	
	private String imageSizeList;

	@DisconfFileItem(name = "groupshare.image.rootdir", associateField = "imageRootDir")
	public String getImageRootDir() {
		return imageRootDir;
	}

	public void setImageRootDir(String imageRootDir) {
		this.imageRootDir = imageRootDir;
	}

	@DisconfFileItem(name = "groupshare.image.gensizelist", associateField = "imageSizeList")
	public String getImageSizeList() {
		return imageSizeList;
	}

	public void setImageSizeList(String imageSizeList) {
		this.imageSizeList = imageSizeList;
	}

}
